import React ,{Component} from 'react'
import PropTypes from 'prop-types';

class TodoItem extends Component{
    constructor(props){
        super(props);
        this.divOnClick = this.divOnClick.bind(this);
    }
    render() {
        const {item} = this.props;
        return (
            <div onClick={this.divOnClick}>
                {item}
            </div>
        )
    }
    divOnClick(){
        this.props.deleteItem(this.props.index);
    }

}
//参数校验
TodoItem.propTypes = {
    item : PropTypes.string
}
//默认值
TodoItem.defaultProps = {
}
export default TodoItem;